<template>
  <a-card class="info" title="员工转正申请表">
    <a-row type="flex" justify="center" v-if="model">
      <a-col :span="24">
        <erp-hr-employee-regular-bill-form ref="realForm" :disabled="true" :printShow="true" normal></erp-hr-employee-regular-bill-form>
        <!-- 流程历史跟踪 -->
        <common-flow-list v-if="model.bpmStatus !== '1'" :formData="formData"></common-flow-list>
      </a-col>
    </a-row>
    <div style="text-align: center;margin-top: 15px;" v-if="model">
      <a-button v-print="'#printContentRegular'" type="primary">打印</a-button>
    </div>
    <div v-else>暂无转正申请信息</div>
    <ErpHrEmployeeRegularBillFormPrint
      v-if="model"
      id="printContentRegular"
      class="print_style"
      :formData="model"
      :formDataHistory="formData"></ErpHrEmployeeRegularBillFormPrint>
    <!-- <erp-hr-employee-regular-bill-modal ref="modalForm" @ok="modalFormOk"></erp-hr-employee-regular-bill-modal>
     <bpm-biz-task-deal-modal ref="taskDealModal" :path="path" :formData="formData"
                             @ok="handleOk"></bpm-biz-task-deal-modal>
     <bpm-process-track-modal ref="bpmProcessTrackModal"></bpm-process-track-modal>
     <biz-task-notify-modal ref="taskNotifyModal"></biz-task-notify-modal>
     <biz-task-notify-me-modal ref="taskNotifyMeModal"></biz-task-notify-me-modal> -->
  </a-card>
</template>

<script>

  import { getAction, postAction } from '@/api/manage'
  import { JeecgBpmListMixin } from '@/mixins/JeecgBpmListMixin'
  // import BizHisTaskModule from "@/views/modules/bpmbiz/common/BizHisTaskModule.vue";
  // import BpmBizTaskDealModal from "@/views/modules/bpmbiz/common/BpmBizTaskDealModal.vue";
  // import BpmProcessTrackModal from "@/views/modules/bpmbiz/common/BpmProcessTrackModal.vue";
  // import BizTaskNotifyModal from "@/views/modules/bpmbiz/common/BizTaskNotifyModal.vue";
  // import BizTaskNotifyMeModal from "@/views/modules/bpmbiz/common/BizTaskNotifyMeModal.vue";
  import ErpHrEmployeeRegularBillForm from '@views/erp/hr/regular/modules/ErpHrEmployeeRegularBillForm'
  import ErpHrEmployeeRegularBillFormPrint from '@views/erp/hr/regular/modules/ErpHrEmployeeRegularBillFormPrint'
  // import ErpHrEmployeeRegularBillModal from '@views/erp/hr/regular/modules/ErpHrEmployeeRegularBillModal'
  import { DisabledAuthFilterMixin } from '@/mixins/DisabledAuthFilterMixin'
  import CommonFlowList from '@/views/components/CommonFlowList.vue'; // 审批历史流程列表

  export default {
    name: 'ErpHrEmployeeRegularBillDetail',
    mixins: [JeecgBpmListMixin, DisabledAuthFilterMixin],
    components: {
     ErpHrEmployeeRegularBillForm,
     ErpHrEmployeeRegularBillFormPrint,
     CommonFlowList
    //  ErpHrEmployeeRegularBillModal,
    //  BizHisTaskModule,
    //  BpmBizTaskDealModal,
    //  BpmProcessTrackModal,
    //  BizTaskNotifyModal,
    //  BizTaskNotifyMeModal,
    },
    data () {
      return {
        model: {},
        id: '',
        url: {
          queryById: '/api/erp/hr/regular/erpHrEmployeeRegularBill/queryRegularByEmployeeId',
          delete: '/api/erp/hr/regular/erpHrEmployeeRegularBill/delete',
          bizCount: '/api/erp/hr/regular/erpHrEmployeeRegularBill/bizCount'
        },
        confirmLoading: false,
        iconStyle: { 'font-size': '20px' },
        disableMixinCreated: true,
        // 代码生成后需手动设置流程编码
        flowCode: 'onl_erp_hr_employee_regular_bill',
        formUrl: 'erp/hr/regular/modules/ErpHrEmployeeRegularBillForm',
        formUrlMobile: ''
      }
    },
    props: {
      employeeId: String
    },
    watch: {
      employeeId: {
        handler: function(val) {
          this.getData(val)
        },
        immediate: true
      },
      // BUG4233 查看多人员工档案信息，信息数据被覆盖
      $route(to, from) {
        this.getData(to.query.id)
      }
    },
    methods: {
      getData(id) {
        getAction(this.url.queryById, { employeeId: id }).then((res) => {
          if (res.success) {
            this.model = res.result
            this.$nextTick(() => {
              this.$refs.realForm.model = res.result;
            })
            // 查询催办
            let params1 = { flowCode: this.flowCode, dataId: res.result.id };// 查询条件
            getAction(this.url.checkNotify, params1).then((res2) => {
              if (res2.result) {
                this.model.taskUrge = true;
              }
            })
            // 查询流程
            let params = { flowCode: this.flowCode, dataId: this.model.id };// 查询条件
            this.viewTrack(params);
          }
        })
      }

    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
</style>
